
<div class="layui-header">
    <div class="layui-logo layui-hide-xs layui-bg-black" id="logoText">小猪博客管理系统</div>
    
    <ul class="layui-nav layui-layout-right">
      <li class="layui-nav-item layui-hide layui-show-md-inline-block">
        <a href="javascript:;">
          <img id="avatar" src=""  class="layui-nav-img">
          <span id="username">请登录</span>
        </a>
        <dl class="layui-nav-child">
          <dd><a href="javascript:;" id="showUserInfo">个人信息</a></dd>
          <dd><a href="javascript:;" id="password">修改密码</a></dd>
          <dd><a href="javascript:;" id="logout">退出</a></dd>
        </dl>
      </li>
      <li class="layui-nav-item" lay-header-event="menuRight" lay-unselect>
        <a href="javascript:;">
          <i class="layui-icon layui-icon-more-vertical"></i>
        </a>
      </li>
    </ul>
</div>

<script src="https://cdn.bootcdn.net/ajax/libs/js-cookie/3.0.1/js.cookie.min.js"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.js"></script>
<script>
  //  获取cookie设置到header页面中，显示用户的信息
   let {
      username,
      intro,
      avatar
    } = JSON.parse(Cookies.get('userInfo'));
    // 回显图片
    $('#avatar').attr('src',avatar)
    $("#username").text(username)
</script>


